#include "logmgr.h"
#include <wx/log.h>

LogManager::LogManager() {
    wxLog::SetLogLevel(wxLOG_Warning);
    wxLog::SetRepetitionCounting();
    
    _p_logfile = NULL;
    //wxLog::SetTimestamp(_T("[%z %F %T]")); // on win32 EN and china local, its useless.
    wxLog::SetLogLevel(wxLOG_Info);
}

wxLogStderr* LogManager::get_file_target() {
    delete _p_logfile;
    _p_logfile = new wxFFile(ConfigManager::get().app_logfile_path.GetFullPath(), _T("a+"));
    
    return new wxLogStderr(_p_logfile->fp());
}

LogManager* LogManager::_log_mgr= NULL;
